package com.example.understandvideo.service.transcode;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.xml.bind.annotation.*;
import java.util.List;

// 抽象基类
@Data// lombok注解，给字段添加getter和setter
@XmlAccessorType(XmlAccessType.FIELD)// 映射所有的字段
@XmlRootElement(name = "inputs")// XML根节点名称，此处为user
@AllArgsConstructor
@NoArgsConstructor
public class CloudInputs {
    // 通用属性或方法
    @XmlElements({
            @XmlElement(name = "image", type = CloudInputsImageItem.class),
            @XmlElement(name = "localfile", type = CloudInputsLocalFileItem.class)
    })
    private CloudInputsItem item;

    public static CloudInputs getImageDefault(String imagePath, String duration, String voicePath) {
        return new CloudInputs(new CloudInputsImageItem(imagePath, "25", duration, "-1", "-1", "-2",
                CloudJoin.getDefault(voicePath),
                new CloudInputsImagePreprocessor(Logodetecter.getDefault(null), "0")
        ));
    }

    public static CloudInputs getLocalFileDefault(String filepath, List<TimeSlice> times) {
        return new CloudInputs(new CloudInputsLocalFileItem(filepath, "0", "4352", "-3", "-1", "0", "0", "0", "0"
                , new CloudInputsLocalFileSubtitleInfo()
                , new CloudInputsLocalFileVideoMetadata()
                , new CloudInputsLocalFilePreprocessor(
                new TimeSliceClipping("1", "1", times),
                new Advertisement(new Mv4EnLight("", "", "-1", "-1", "-2", "0", "", "-1", "-1", "-2")),
                "0"

        )));
    }
}